package com.firexxx.study.socket;

import java.io.IOException;
import java.net.InetSocketAddress;
import java.net.ServerSocket;
import java.net.Socket;

/**
 * @description: TODO
 * @author: zhuangzhang2
 * @date: 2021-02-09 10:28
 */
public class Server {

    public static void main(String[] args) throws IOException {
        ServerSocket serverSocket = new ServerSocket();
        serverSocket.bind(new InetSocketAddress("127.0.0.1", 8080));
        Socket clientSocket = serverSocket.accept();
        int a = clientSocket.getInputStream().read();
        clientSocket.getOutputStream().write(2);
        System.out.println(a);
    }

}
